package edu.ccut.saturn.studio.logic.figure;

import org.eclipse.draw2d.AbstractBorder;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Insets;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;

/// 已经被废弃。下一个版本应该删除。
public class ExitFigure extends AbstractBorder {
	public Insets getInsets(IFigure figure) {
		return new Insets(1, 0, 0, 0);
	}

	public void paint(IFigure figure, Graphics graphics, Insets insets) {
		// graphics.drawLine(getPaintRectangle(figure, insets).getTopLeft(),
		// getPaintRectangle(figure, insets).getTopRight());
		// graphics.drawRectangle(getPaintRectangle(figure, insets));
		PointList points = new PointList();
		Point point = figure.getBounds().getLocation();
		int width = figure.getBounds().width;
		int height = figure.getBounds().height;
		Point point2 = new Point(point.x + width - 1, point.y);
		Point point3 = new Point(point.x + width - 1, point.y + height - 1);// (point2.x,
		// point2.y
		// +
		// height);
		Point point4 = new Point(point.x, point.y + height - 1);// (point3.x-width,
		// point3.y );

		points.addPoint(point);
		points.addPoint(point2);
		points.addPoint(point3);
		points.addPoint(point4);

		graphics.drawPolygon(points);

	}
}
